//
//  LTCTwoViewController.swift
//  UIKitCatalog
//
//  Created by LiJonius on 16/1/25.
//  Copyright © 2016年 Apple. All rights reserved.
//

import UIKit

/**
 *	@brief	定义一个 协议
 *
 *	@param 	String 	姓名
 *	@param 	String 	年龄
 *
 *	@return	姓名 和 年龄
 */
protocol TwoViewControlDelegate{
    func changeLabel(name : String , age : String)
}

class LTCTwoViewController: UIViewController {
    /**
     *	@brief	声明 delegate
     */
    var delegate : TwoViewControlDelegate?
    var button : UIButton!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor=UIColor.whiteColor()
        configureButton()
        // Do any additional setup after loading the view.
    }
    
    /**
     *	@brief	初始化button
     *
     *	@return	nil
     */
    func configureButton(){
        self.button=UIButton(type: .Custom)
        self.button.frame = CGRectMake(20, 150, 60, 32)
        //button.backgroundColor=UIColor.redColor()
        self.button.backgroundColor=UIColor(red: 0.5, green: 0.4, blue: 0.3, alpha: 1.0)
        self.button.addTarget(self, action: "clickBtn", forControlEvents: UIControlEvents.TouchUpInside)
        self.view.addSubview(self.button)
    }
    /**
     *	@brief	点击按钮 触发事件
     *
     *	@return	nil
     */
    func clickBtn(){
        NSLog("click ：按下按钮")
        self.delegate?.changeLabel("小明", age: "18")
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
